package su.samcom.calc.model.entity;

import javax.persistence.*;
import java.io.Serializable;
import java.util.List;

/**
 * Created with IntelliJ IDEA.
 * User: Владислав
 * Date: 19.11.13
 * Time: 23:25
 * To change this template use File | Settings | File Templates.
 */
@Entity
@Table(name = "calc_samcom_su.price_group")
public class PriceGroup implements Serializable {
    private static final long serialVersionUID = 9126051204708767572L;

    private Long id;
    private List<Price> prices;

    @Id
    @SequenceGenerator(name = "price_group_gen", sequenceName = "calc_samcom_su.price_group_seq", allocationSize = 1)
    @GeneratedValue(generator = "price_group_gen", strategy = GenerationType.SEQUENCE)
    @Column(name = "id")
    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    @OneToMany(mappedBy = "priceGroup", fetch = FetchType.LAZY)
    @OrderBy(value = "loadedPercent")
    public List<Price> getPrices() {
        return prices;
    }

    public void setPrices(List<Price> prices) {
        this.prices = prices;
    }
}
